<%@ page pageEncoding="UTF-8"%>
<%@ page import="org.myhomework.constant.Constants"%>
<%
    Integer type = (Integer) request.getSession().getAttribute(Constants.USER_TYPE_ATTRIBUTE);
    if (null != type) {
        response.sendRedirect(Constants.ADMIN_TYPE == type ? "/admin" : "teacher");
        return;
    }
%>
<!DOCTYPE html>
<html>
    <head>
        <META http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <style>
            #blog-login-welcome-title {
                width: 700px;
                margin: 10px auto;
                color: #fff;
            }
            #login-container {
                margin: 200px auto;
                border: 1px solid gray;
                width: 700px;
                padding: 10px;
                background-color: rgba(0, 0, 0, 0.3);
            }
            .login-group-item {
                width: 60%;
                margin: 10px auto;
            }
            .login-group-item-label {
                color: #fff;
                width: 20%;
                font-size: 20pt;
            }
            .login-group-item > input {
                display: block;
                height: 25px;
                width: 80%;
                margin-top: 10px;
            }
            .inline {
                display: inline-block;
            }
            #login-button {
                margin-top: 10px;
                width: 120px;
                height: 45px;
                font-size: 15pt;
            }
            body {
                background-image: url(/static/img/bg.webp);
            }
            a:link{color:#000000;}
            a:visited {color:#00FF00;}
            a:hover {color:#FF00FF;}
            a:active {color:#0000FF;}
        </style>
    </head>
    <body>
        <div id="blog-login-welcome-title"><h1>欢迎登录教师管理系统</h1></div>
        <div id="login-container">
            <form method="post" action="/login">
            <div class="login-group-item">
                <div class="login-group-item-label inline">用户名</div>
                <input type="text" name="username" />
            </div>
            <div class="login-group-item">
                <div class="login-group-item-label inline">密码</div>
                <input type="password" name="password" />
            </div>
            <div class="login-group-item">
                <button type="submit" id="login-button">登录</button>
            </div>
            <div class="login-group-item">
                <a href="/register">注册</a>
            </div>
            </form>
        </div>
    </body>
</html>